#include <16F887.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT                    //No Power Up Timer
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOCPD                    //No EE protection
#FUSES NOBROWNOUT               //No brownout reset
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOWRT                    //Program memory not write protected
#FUSES BORV40                   //Brownout reset at 4.0V

#use delay(clock=20000000)

#define EEPROM_SCL   PIN_C3
#define EEPROM_SDA   PIN_C4
#use i2c(master, sda=EEPROM_SDA, scl=EEPROM_SCL)  

enum leds{
LED_D1=1,
LED_D2,
LED_D3,
LED_D4,
LED_D5,
LED_D6,
LED_D7,
LED_D8,
LED_D9,
LED_D10,
LED_D11,
LED_D12,
LED_D13,
LED_D14,
LED_D15,
LED_D16,
};

enum colors{
BLACK = 0,
GREEN,
RED,
REDGREEN,
};

void computeDelayTime(int16 *secDelay,int16 *minDelay,int16 *houDelay,BYTE gHou,BYTE gMin,BYTE gSec );
void swapint(int16 *a, int16 *b);
void sort_3( int16 order[], int16 hour, int16 min, int16 sec);
void create_second_hand(BYTE cmd[]);
void create_minute_hand(BYTE cmd[]);
void create_hour_hand(BYTE cmd[]);
void generate_data(int8 leds_name,int8 color_value,BYTE cmd[]);
void display_frame(BYTE cmd[]);
void put_byte(BYTE cmd);
void boundary();
